﻿using System;
using System.Data;
using System.Linq;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using PMSGSC.BLL;
using PMSGSC.DAL;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;

namespace PMSGSC.App
{
    public partial class rpOverDueWork : DevExpress.XtraReports.UI.XtraReport
    {
        public rpOverDueWork(List<Department> dataSource)
        {
            InitializeComponent();
      
            xrLabel33.Text = DateTime.Now.Date.ToString("MM/dd/yyyy");
            this.Parameters["TimeNow"].Value = DateTime.Now.Date; 
            bindingSource1.DataSource = dataSource;
            OpenDocument();
      
        }
        private void OpenDocument()
        {
            string Address = Application.StartupPath + "\\Attachment\\";
            Directory.CreateDirectory(Address);
            if (null != bindingSource1.DataSource)
            {
                try
                {
                    Department department = bindingSource1.Cast<Department>().ToList()[0];
                    string fileName = department.Ship.NameShip + department.Ship.Extension;
                    Address += fileName;
                    xrPictureBox1.ImageUrl = Address;
                }
                catch { }
            }
        }
    }
}
